// filepath: d:\localwork\playwrightTest\web\src\index.js
import './style.less'

document.addEventListener('DOMContentLoaded', () => {
  document.body.innerHTML = `
    <div class="container">
      <h1>Demo Site</h1>
      <button id="api-btn">Fetch API</button>
      <div id="api-message"></div>
    </div>
  `
  
  document.getElementById('api-btn').onclick = async () => {
    const res = await fetch('/api')
    const data = await res.json()
    document.getElementById('api-message').textContent = data.message
  }
})